package April._26.answer.work2;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Method;

public class AnnotationTest {
    @Review(comment = "Check for performance issues")
    public void processData() {
        System.out.println("Processing data...");
    }

    @Review
    public void calculate() {
        System.out.println("Calculating values...");
    }

    public static void main(String[] args) {
        for (Method method : AnnotationTest.class.getDeclaredMethods()) {
            if (method.isAnnotationPresent(Review.class)) {
                Review review = method.getAnnotation(Review.class);
                System.out.println("Method " + method.getName() + " needs review: " + review.comment());
            }
        }
    }
}

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@interface Review{
    String comment() default "Please review this method";

}
